<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>材料供货商确认审核</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../../resources/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../resources/css/style.css" media="all">
    <style>
        .layui-form-label{width: 100px; height: 20px;}
        .layui-form-select{width: 190px;}
        #gonghuoshijian{ width: 100%;}
        .addUser input{width: 86%;}
        .layui-form-select{width: 100%!important;}
        .layui-form-select input{width: 100%;}
        .layui-form-item{padding-left: 70px;}
        .layui-form-item .layui-input-inline{width: 73%!important;}
        .masksx{width: 800px;}
        .material{display: flex;justify-content: flex-start;padding-left: 15px;padding-right: 77px;margin-bottom: 8px;width: 100%;margin-left: 55px;}
        .material label{float: left;height: 38px;line-height: 38px; display: inline-block;}
        ._mater{width: 49%;margin-left: 30px;}
        .layui-form-select .layui-input{padding-right: 0;}
        ._materwarp{width: 43%;}
        .masksx .forms{padding-left: 78px;}
        .material ._mater_input{width: 10%;}
        ._mater_lab{margin:0 20px;}
        .addTo{background-color: #86B1FC;color: #FFF; width: 10px;height: 10px;display: none}
        .materialone .addTo{display:inline;}
        .mater_btn{margin: 6px 0 0 6px;}
        .material_C{width: 100px;text-align: justify;}
        .material_C:after{content:'';width: 100%;display: inline-block;}
        .materialone .mater_btn{display: none;}
        .forms{padding-top: 20px;}
        .layui-form-selectup dl{top: -184px;}
        @media screen and (max-width: 768px){
            .MOVE_queryon .layui-form-item {
                width: 80%;
            }
            .layui-form-item{padding: 0;}
            .MOVE_footer{text-align: right;}
            .MOVE_footer a{color: #FFF;font-size: 20px;line-height: 30px;
                padding: 10px;background-color: #F5A721;height: 100%;position: absolute;right: 0;}
        }
        .layui-form-pane .layui-input-inline{width: 80%;}
        .layui-inline{margin-bottom: 10px;}
        .layui-table, .layui-table-view{margin-top: 0;}
    </style>
</head>
<body>
<div class="_PC">
    <a class="dayin" type="button" id="dlink"  style="float: right; position: fixed; right: 50px; bottom: 50px; z-index: 999;"></a>
    <form class="layui-form layui-form-pane" id="form_7grid" action="" lay-filter="hetong">
        <div class="formTop">
            <div class="layui-inline layui-col-lg3 layui-col-md3 layui-col-sm3" style="margin-bottom: 10px;">
                <div class="layui-input-inline" style="width: 80%;">
                    <input type="text" name="ghCode" lay-verify="required" placeholder="供货单单号" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline layui-col-lg3 layui-col-md3 layui-col-sm3" style="margin-bottom: 10px;">
                <div class="layui-input-inline" style="width: 80%;">
                    <input type="text" name="proName" lay-verify="required" placeholder="项目名称" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline layui-col-lg3 layui-col-md3 layui-col-sm3" style="margin-bottom: 10px;">
                <div class="layui-input-inline" style="width: 80%;">
                    <input type="text" name="buildName" lay-verify="required" placeholder="施工单位名称" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline layui-col-lg3 layui-col-md3 layui-col-sm3" style="margin-bottom: 10px;">
                <div class="layui-input-inline" style="width: 80%;">
                    <input type="text" name="fhr" lay-verify="required" placeholder="请输入发货人" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline layui-col-lg3 layui-col-md3 layui-col-sm3">
                <div class="layui-input-inline">
                    <select name="rd" lay-verify="required" lay-search="">
                        <option value="">请选择审核状态</option>
                        <option value="0">已审核</option>
                        <option value="-1">等待审核</option>
                    </select>
                </div>
            </div>

            <div class="layui-inline layui-col-lg3 layui-col-md3 layui-col-sm3 ">
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="test-limit3" name="begintime" placeholder="请输入发货开始日期">
                    <div class="icons">
                    </div>
                </div>
            </div>
            <div class="layui-inline layui-col-lg3 layui-col-md3 layui-col-sm3">

                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="test-limit4" name="endtime" placeholder="请输入发货结束日期">
                    <div class="icons">
                    </div>
                </div>
            </div>
            <div>
                <button class="layui-btn tijiao" type="button" onclick="query()" style="margin-bottom: 10px;">查询
                </button>
                <button class="layui-btn" type="button" onclick="checkTab()" style="margin-bottom: 10px;">核验表
                </button>
            </div>

        </div>
        <table id="demo" lay-filter="test"></table>
        <script type="text/html" id="barDemo">
            <a class="layui-btn layui-btn-sm layui-btn-normal shenhe quanxian" lay-event="shenqing" QX="api/buil/builGhVali.do">审核</a>
            <a class="layui-btn layui-btn-sm layui-btn-normal layui-btn-disabled jinshenhe quanxian" lay-event="jinshenqing" QX="api/buil/builGhVali.do">审核</a>
            <!--<a class="layui-btn layui-btn-sm" lay-event="edit">编辑</a>-->
            <a class="layui-btn layui-btn-danger layui-btn-sm chakan quanxian" lay-event="detail" QX="api/matperson/loadghMoudle.do">查看</a>
            <a class="layui-btn layui-btn-danger layui-btn-sm chakan quanxian" lay-event="reset1" QX="api/matperson/resetRecvMaterial.do">重置</a>
            <a class="layui-btn layui-btn-danger layui-btn-sm chakan quanxian" lay-event="print" QX="api/matperson/loadghMoudle.do">打印</a>
        </script>
        <!--<script type="text/html" id="titleTpl">-->

        <!--<span>{{times(1510635999999)}}</span>-->

        <!--</script>-->
    </form>
    <div id="demo7"></div>


</div>



<script src="../../../resources/layui/layui.js" charset="utf-8"></script>
<script src="../../../resources/js/style.js"></script>
<script src="../../../resources/js/api.js"></script>
<script>
    console.log(urls + 'ureport/preview?_u=file:供料单.ureport.xml' );
    function checkTab() {
        layui.use(['form', 'layedit', 'laydate','table','element'], function() {
            layer.open({
                type: 2,
                title: '核验单',
                maxmin: 'true',
                shadeClose: true,
                area: ['520px', '340px'], //宽高
                shade: 0.8,
                content: urls + '/ureport/preview?_u=file:heyan.ureport.xml' //iframe的url
            });
        });
    }

    function query() {
        layui.use(['form', 'layedit', 'laydate','table','element'], function() {
            var form = layui.form
                , table = layui.table;
            var proName=$('[name="proName"]').val();
            var begintime=$('[name="begintime"]').val();
            var endtime=$('[name="endtime"]').val();
            var rd=$('[name="rd"]').val();
            var ghCode=$('[name="ghCode"]').val();
            var buildName=$('[name="buildName"]').val();
            var fhr=$('[name="fhr"]').val();


            if(!AntiSqlValid(proName)){
                if(lbq('api/matperson/loadghMoudle.do')) {
                    API.cailiaogonghuoqueding({'type':'a','proName':proName,'begintime':begintime,'endtime':endtime,'p':getCookie('yanzheng'),'rd':rd,'ghCode':ghCode,'buildName':buildName,'fhr':fhr})
                }
            }else {
                layer.msg('请勿输入特殊符号');
            };
        })

    }



    layui.use(['form', 'layedit', 'laydate','table','element','laypage','flow'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate
            ,table=layui.table
            ,laypage=layui.laypage
            ,flow=layui.flow
            ,element=layui.element;
        jiazais();

        laydate.render({
            elem: '#gonghuoshijian' //指定元素
            ,type: 'datetime'
        });
        dayintishi('.dayin');

        $(document).on('click','.mater_btn',function () {
            $(this).parent().remove();
        })

        $('.close').click(function () {     //遮罩层隐藏
            $('.mask').hide();
        });

        $('.demoTable .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        //执行渲染

            if(lbq('api/matperson/loadghMoudle.do')){
                API.cailiaogonghuoqueding({'type':'a','p':getCookie('yanzheng')});
            }


//
        //前后若干天可选，这里设置不能选过去的日期      最远可选1000天之后
        panduanshijiantow('#test-limit3','#test-limit4',1000,1000,'.tijiao');     //查询 开始结束时间判断




        //监听工具条
        table.on('tool(test)', function(obj){ //注<span class="maohao">：</span>tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
            var data = obj.data; //获得当前行数据
            var layEvent = obj.event; //获得 lay-event 对应的值
            var tr = obj.tr; //获得当前行 tr 的DOM对象

            if(layEvent === 'detail'){ //查看
                //do somehing
                //////console.log(obj)
                sessionStorage.remark=obj.data.rm_Code;
                location.href='./CgonghuoquedingDe.html';


            }else if(layEvent==='shenqing'){
                //////console.log(obj)
                sessionStorage.uuid=obj.data.rm_Code
                sessionStorage.cc_uuid=obj.data.cc_UUID;

                sessionStorage.danhao=obj.data.rm_Code;
                location.href='./CgonghuoquedingSH.html';
            }else if(layEvent==="reset1"){
                layer.confirm('您确认要重置此发货单吗?', {
                    btn: ['确定','取消'] //按钮
                }, function(){
                    ajaxs('/api/matperson/resetRecvMaterial.do','post',{'rmCode':obj.data.rm_Code,'p':getCookie('yanzheng')},function (data) {
                        if(data.code==0){
                            layer.msg(data.msg, {icon: 1});
                        }else{
                            layer.msg(data.msg, {icon: 2});
                        }
                    })
                });
            }else if ( layEvent === 'print' ){
                layer.open({
                    type: 2,
                    title: '核验单',
                    maxmin: 'true',
                    shadeClose: true,
                    area: ['520px', '340px'], //宽高
                    shade: 0.8,
                    content: urls + '/ureport/preview?_u=file:recv_ticket.ureport.xml&rmCode=' + obj.data.rm_Code  //iframe的url
                });
            }
        });

        form.on('submit(_subm)',function (data) {
            //////console.log(data.field)

            return false;
        })
        $("[name='feed_Code']").blur(function () {
            //////console.log($(this).val()!= $("[name='namespan']").val())
            if($(this).val()== $("[name='namespan']").val()){
                return;
            }
            ajaxs('/api/public/cheName.do','get',{'type':3,'name':$(this).val(),'p':getCookie('yanzheng')},function (data) {
                //////console.log(data)
                if(data.code==0){
                    if(data.data=='1'){
                        layer.msg('申请单号已存在 请重新输入');
                        $('.tijiao').attr('disabled','true').addClass('layui-btn-disabled');//禁止提交按钮点击
                    }else{
                        layer.msg('申请单号可用');
                        $('.tijiao').removeAttr('disabled').removeClass('layui-btn-disabled');//禁止提交按钮点击
                    }

                }
            })
        })
        inputs();
        //材料添加
        $('.material_C').click(function () {
            var _dom=$(this).parents('.materialone').html();
            $('.materialone').after('<div class="material">'+_dom+'</div>');

            form.render();
        })
//        //移动端流加载
//        flow.load({
//            elem: '#LAY_demo1' //流加载容器
//            ,scrollElem: '#LAY_demo1' //滚动条所在元素，一般不用填，此处只是演示需要。
//
//            ,done: function(page, next){ //执行下一页的回调
//                var lis = [];
//                //模拟数据插入
//                ajaxs('/api/ctteam/loadMatFeedList.do','post',{'currPage':page,'p':getCookie('yanzheng')},function (data) {
//                    //////console.log(data)
//                    if(data.totalNum==0){
//                        $('.layui-flow-more')
//                    }
//                    var datas=data.data||[]
//                    var lis = [];
//
//                    for(var i=0;i<datas.length;i++){
//                        lis.push('<li>\n' +
//                            '                <div class="MOVE_details">\n' +
//                            '                    <div class="MOVE_numbers">\n' +
//                            '                        <span class="MOVE_numberson">'+datas[i].eppName+'</span>\n' +
//                            '                    </div>\n' +
//                            '                    <div class="MOVE_list">\n' +
//                            '                        <p><span class="MOVE_listL">起止点：</span><span class="MOVE_listR">'+datas[i].eppStaEnd+'</span></p>\n' +
//                            '                        <p><span class="MOVE_listL">创建时间：</span><span class="MOVE_listR">'+datas[i].createTime+'  </span></p>\n' +
//                            '                        <p><span class="MOVE_listL">申请单数量：</span><span class="MOVE_listR">'+datas[i].number+'</span></p>\n' +
//                            '<input type="hidden" class="Usid" value="'+datas[i].cc_UUID+'"/>'+
//                            '                    </div>\n' +
//                            '\n' +
//                            '                </div>\n' +
//                            '\n' +
//                            '            </li>')
//
//
//
//                    }
//                    //滑动监听
//                    $(document).on('touchstart','#LAY_demo1 li',function (event) {
//                        //////console.log($(this))
//                        sessionStorage.cs_id=$(this).attr('uid');
//                        huadong('LAY_demo1',function () {
//                            location.href='./CgonghuoquedingDe.html';
//                        })
//                    });
//
//                    //pages为Ajax返回的总页数，只有当前页小于总页数的情况下，才会继续出现加载更多
//                    next( lis.join(''),page < data.pageBean.pageCount);
//                })
//
//            }
//        });


    })

</script>
</body>
</html>